package com.yanqu.road.entity.activity.fivehero.cross;

import com.yanqu.road.entity.DataObject;
import com.yanqu.road.entity.DataStatus;
import com.yanqu.road.entity.FieldTypeAnnotation;

import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

@FieldTypeAnnotation(tableName = "t_c_fivehero_data")
public class CrossFiveHeroData extends DataObject {

    private int groupId;

    @FieldTypeAnnotation(desc = "活动ID", select = true, update = true)
    private int activityId;

    @FieldTypeAnnotation(desc = "锁榜单")
    private boolean lockUnion;

    @FieldTypeAnnotation(desc = "锁门客")
    private boolean lockPatrons;

    private Map<String,Map<Integer,CrossFiveHeroBookData>> bookMap = new ConcurrentHashMap<>();

    //使用残卷的玩家的信息也要统计
    private Map<String,Map<Long,Integer>> bookMakerMap = new ConcurrentHashMap<>();

    private Map<Integer,Long> winnerMap = new ConcurrentHashMap<>();

    // ===============================================

    public int getActivityId() {
        return activityId;
    }

    public void setActivityId(int activityId) {
        if (this.activityId != activityId) {
            this.activityId = activityId;
            setOp(DataStatus.Update);
        }
    }

    public boolean isLockUnion() {
        return lockUnion;
    }

    public void setLockUnion(boolean lockUnion) {
        if (this.lockUnion != lockUnion) {
            this.lockUnion = lockUnion;
            setOp(DataStatus.Update);
        }
    }

    public boolean isLockPatrons() {
        return lockPatrons;
    }

    public void setLockPatrons(boolean lockPatrons) {
        if(lockPatrons != this.lockPatrons){
            this.lockPatrons = lockPatrons;
            setUpdateOption();
        }
    }

    public Map<String, Map<Integer, CrossFiveHeroBookData>> getBookMap() {
        return bookMap;
    }

    public Map<Integer, CrossFiveHeroBookData> getBookMap(String unionUid) {
        if(!bookMap.containsKey(unionUid)){
            bookMap.put(unionUid,new ConcurrentHashMap<>());
        }
        return bookMap.get(unionUid);
    }

    public void setBookMap(String unionUid,Map<Integer, CrossFiveHeroBookData> bMap) {
        bookMap.put(unionUid,bMap);
    }

    public void setBookMap(Map<String, Map<Integer, CrossFiveHeroBookData>> bookMap) {
        this.bookMap = bookMap;
    }

    public Map<Integer, Long> getWinnerMap() {
        return winnerMap;
    }

    public void setWinnerMap(Map<Integer, Long> winnerMap) {
        this.winnerMap = winnerMap;
        setUpdateOption();
    }

    public Map<String, Map<Long, Integer>> getBookMakerMap() {
        return bookMakerMap;
    }

    public void setBookMakerMap(Map<String, Map<Long, Integer>> bookMakerMap) {
        this.bookMakerMap = bookMakerMap;
        setUpdateOption();
    }

    public int getGroupId() {
        return groupId;
    }

    public void setGroupId(int groupId) {
        this.groupId = groupId;
    }
}
